﻿import mx.utils.Delegate;
import gs.TweenLite;
class cn.eminia.ComboClassV1.Popup {
	var list:MovieClip;
	var msk:MovieClip;
	var it:MovieClip;
	var ss;
	var onOpen, onClose;
	function Popup(list, msk, vars) {
		if (msk.constructor != MovieClip) {
			throw new Error('!!! Popup.msk != MC');
		}
		if (list.constructor != MovieClip) {
			throw new Error('!!! Popup.list != MC');
		}
		this.list = list;
		this.msk = msk;
		//
		this.it = vars.it;
		//
		msk._width = vars.width;
		msk._height = vars.height;
		//
		list._y = msk._y-vars.height;
		// 
		list.setMask(msk);
		this.onOpen = vars.onOpen;
		this.onClose = vars.onClose;
	}
	function updateSS(id, old, now) {
		if (now) {
			TweenLite.to(list, .4, {_y:msk._y});
			this.onOpen({it:it});
		} else {
			TweenLite.to(list, .3, {_y:msk._y-msk._height});
			this.onClose({it:it});
		}
	}
}
